package com.teame.readbaby;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.teame.readbaby.parser.CheckOutParser;
import com.teame.readbaby.util.ConstantValue;
import com.teame.readbaby.util.Logger;
import com.teame.readbaby.vo.AddressListInfo;
import com.teame.readbaby.vo.CheckOutInfo;

public class PaymentCenterAactivity extends BaseActivity {

	protected static final String TAG = "PaymentCenterAactivity";

	private TextView payment_orderPrice_text;// 您共需为订单支付：￥270

	private TextView shopcar_total_buycount_text;// 结算数量总计
	private TextView shopcar_total_bonus_text;// 赠送积分总计
	private TextView shopcar_total_money_text;// 金额总计

	private TextView ordr_submit_bottom_text;// 提交订单

	private RelativeLayout payment_address_rel;// 选择地址
	private RelativeLayout payment_payType_rel;// 选择付款方式
	private RelativeLayout payment_sendTime_rel;// 选择送货之间
	private RelativeLayout payment_invoice_rel;// 选择发票抬头
	private RelativeLayout payment_remark_rel;// 选择留言

	private ListView payment_product_list;// 商品信息展示，需要设置适配器
	
	

	public PaymentCenterAactivity() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void findViewById() {

		payment_orderPrice_text = (TextView) this
				.findViewById(R.id.payment_orderPrice_text);

		shopcar_total_buycount_text = (TextView) this
				.findViewById(R.id.shopcar_total_buycount_text);
		shopcar_total_bonus_text = (TextView) this
				.findViewById(R.id.shopcar_total_bonus_text);
		shopcar_total_money_text = (TextView) this
				.findViewById(R.id.shopcar_total_money_text);

		ordr_submit_bottom_text = (TextView) this
				.findViewById(R.id.ordr_submit_bottom_text);

		payment_address_rel = (RelativeLayout) this
				.findViewById(R.id.payment_address_rel);
		payment_payType_rel = (RelativeLayout) this
				.findViewById(R.id.payment_payType_rel);
		payment_sendTime_rel = (RelativeLayout) this
				.findViewById(R.id.payment_sendTime_rel);
		payment_invoice_rel = (RelativeLayout) this
				.findViewById(R.id.payment_invoice_rel);
		payment_remark_rel = (RelativeLayout) this
				.findViewById(R.id.payment_remark_rel);

		payment_product_list = (ListView) this
				.findViewById(R.id.payment_product_list);
	}

	/**
	 * 加载布局文件
	 */

	protected void loadViewLayout() {
		this.setContentView(R.layout.payment_center_activity);

	}

	/**
	 * 向本地请求数据
	 */
	@Override
	public void processLogic() {
		// TODO Auto-generated method stub
		// 1,请求的url地址
		// 2,请求的参数，没有为null
		// Map<String, String> params=new HashMap<String, String>();
		// 如果有参数 这样写
		// params.put("version", "1");
		// 3.json数据解析器，大家需要按照自己获取json的结构自己编写，要继承baseParser
		// 4,回调函数

		String url = ConstantValue.HOST + ConstantValue.CHECKOUT;
//		Map<String, String> params = new HashMap<String, String>();
//		params.put("Sku", "Sku");

		System.out.println("processLogic方法执行。。开始");
		this.getDataFromServer(url, null, new CheckOutParser(),
				new DataCallback<CheckOutInfo>() {

					@Override
					public void processData(CheckOutInfo paramObject,
							boolean paramBoolean) {

						// 对封装信息需要展示，先打印下
						if (!paramBoolean || paramObject == null) {// 获取失败

						} else {// 获取成功
								//先打印测试一下吧
								Logger.i(TAG, paramObject.toString());
								System.out.println("processLogic方法执行。。结束");
						}

					}
				});

	}

	@Override
	/**
	 * 设置监听
	 */
	protected void setListener() {
		// 收货人信息
		payment_address_rel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

			}
		});

		// 支付方式
		payment_payType_rel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

			}
		});

		// 送货时间
		payment_sendTime_rel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

			}
		});

		// 发票抬头
		payment_invoice_rel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

			}
		});

		// 留言信息
		payment_remark_rel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

			}
		});

	}

	@Override
	protected void onClickEvent(View paramView) {
		// TODO Auto-generated method stub
		
	}

}
